/*
 * Copyright 2025 KylinSoft Co., Ltd.
 *
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <https://www.gnu.org/licenses/>.
 */

import QtQml 2.15
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import org.ukui.quick.items 1.0 as UkuiItems
import org.ukui.quick.platform 1.0

Item {
    property alias labelText: label.text
    property bool enableHighlight: false
    property int itemIndex: -1

    signal customButtonClicked()

    Rectangle {
        anchors.fill: parent
        radius: 6
        color: {
            if (enableHighlight)
                return Theme.highlight();
            else
                return optionMouseArea.containsMouse ? Theme.midLight() : Theme.button();
        }
        Theme.onPaletteChanged: {
            color = Theme.button();
        }

        Text {
            id: label

            anchors.centerIn: parent
            color: enableHighlight ? Theme.highlightedText() : Theme.buttonText()
        }

        MouseArea {
            id: optionMouseArea

            anchors.fill: parent
            hoverEnabled: true
            onClicked: {
                customButtonClicked();
            }
        }

    }

}
